package com.molin.mapTest;

import java.util.HashMap;
import java.util.Map;

public class Demo1 {
    public static void main(String[] args) {
        Map<String, String> studentsMap = new HashMap<>();
        studentsMap.put("molin001", "xiaozhi");
        studentsMap.put("molin002", "xiaomei");
        studentsMap.put("molin003", "xiaohei");
        String put = studentsMap.put("molin003", "xiaohei2");
        System.out.println(put);
        System.out.println(studentsMap);
        String molin003 = studentsMap.remove("molin003");
        System.out.println(molin003);
        System.out.println(studentsMap);
        studentsMap.clear();
        System.out.println(studentsMap);
        System.out.println("===========clear============");
        studentsMap.put("molin001", "xiaozhi");
        studentsMap.put("molin002", "xiaomei");
        studentsMap.put("molin003", "xiaohei");
        boolean molin001 = studentsMap.containsKey("molin001");
        System.out.println(molin001);
        System.out.println(studentsMap);
        boolean xiaomei = studentsMap.containsValue("xiaomei2");
        System.out.println(xiaomei);
        System.out.println(studentsMap);
        boolean empty = studentsMap.isEmpty();
        System.out.println(empty);
        int size = studentsMap.size();
        System.out.println(size);
        studentsMap.clear();
        boolean empty1 = studentsMap.isEmpty();
        System.out.println(empty1);
        System.out.println(studentsMap.size());
    }
}
